package net.akkz.dbFactory.impl;

import java.sql.*;

import net.akkz.dbFactory.DbManage;
import net.akkz.dbFactory.Session;

public class DbManageImpl implements DbManage
{
	private String username;
	private String password;
	private String url;

	public DbManageImpl(){}

	public String getUsername()
	{
		return username;
	}

	public void setUsername(String username)
	{
		this.username = username;
	}

	public String getPassword()
	{
		return password;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}

	public String getUrl()
	{
		return url;
	}

	public void setUrl(String url)
	{
		this.url = url;
	}

	public Session createSession()
	{
		try
		{
			Class.forName("com.mysql.jdbc.Driver");

			return new SessionImpl(DriverManager.getConnection(url, username, password));
		}
		catch (ClassNotFoundException e)
		{
			e.printStackTrace();
		}
		catch (SQLException e)
		{
			e.printStackTrace();
		}

		return null;
	}
}
